package com.jt.sca.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
/*
* 定义请求解析器,用于对请求解析并返回解析的结果,sentinel底层在拦截到用户请求以后,会对请求
*  数据基于此对象进行解析,判定是否符合黑白名单的规则
*
* */
@Component
public class DefaultRequestOriginParser implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest request) {
        //获取请求参数origin的值
        return request.getParameter("origin");
    }
}
